package com.cxz.kotlin.baselibs.base

import android.content.Context
import android.content.Intent
import android.text.format.DateUtils
import com.cxz.kotlin.baselibs.utils.AppManager
import com.cxz.kotlin.baselibs.utils.LogUtil


class CrashHandler : Thread.UncaughtExceptionHandler {

    /**
     *  单例对象
     */
    companion object {
        val Instance by lazy { CrashHandler() }
    }

    private lateinit var mContext: Context

    override fun uncaughtException(t: Thread?, e: Throwable?) {
        LogUtil.e("uncaughtException","uncaughtException->${e.toString()},${e?.stackTrace}")

    }

    /**
     * 在Application 中进行全局初始化
     */
    fun init(context: Context) {
        mContext = context
        Thread.setDefaultUncaughtExceptionHandler(this)
    }
}